using System.Collections.Generic;

namespace NFreeMarker.Template
{
    /**
     * Sequence that wraps a <code>java.util.List</code> of already wrapped objects
     * directly, with minimal resource usage. Warning! It does not copy the original
     * list.
     *
     * @author Daniel Dekany
     * @version $Id: TemplateModelListSequence.java,v 1.2 2004/01/06 17:06:43 szegedia Exp $
     */

    public class TemplateModelListSequence : ITemplateSequenceModel
    {
        private readonly List<ITemplateModel> _list;

        public TemplateModelListSequence(List<ITemplateModel> list)
        {
            _list = list;
        }

        public ITemplateModel Get(int index)
        {
            return _list[index];
        }

        public int Size()
        {
            return _list.Count;
        }

        public object GetWrappedObject()
        {
            return _list;
        }
    }
}